<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增或修改敏感信息属性')"/>
</head>
<body>
<div class="main-content">
    <form id="form-user-add" class="form-horizontal" th:object="${infoField}">
        <th:block th:if="${infoField != null}">
            <input type="hidden" name="id" th:value="*{id}"/>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">属性编码：</label>
                        <div class="col-sm-8">
                            <input name="code" placeholder="请输入编码" class="form-control" th:value="*{code}" type="text" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">属性名称：</label>
                        <div class="col-sm-8">
                            <input name="name" placeholder="请输入名称" class="form-control" th:value="*{name}" type="text" required>
                        </div>
                    </div>
                </div>
        </th:block>
        <th:block th:unless="${infoField != null}">
            <input type="hidden" name="id"/>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">属性编码：</label>
                        <div class="col-sm-8">
                            <input name="code" placeholder="请输入编码" class="form-control" type="text" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">属性名称：</label>
                        <div class="col-sm-8">
                            <input name="name" placeholder="请输入名称" class="form-control" type="text" required>
                        </div>
                    </div>
                </div>
            </div>
        </th:block>
    </form>
</div>

<th:block th:include="include :: footer"/>
<script>
    var prefix = ctx + "system/sensitive/infoField";

    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-user-add').serializeArray();
            $.operate.save(prefix + "/saveOrUpdate", data);
        }
    }

</script>
</body>
</html>
